# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.


class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time

  #cattr_accessor :current_question_pool          --> ##TOFIX## : I tried to implement it as a class instance but without success... I will lose my time later, now implemented as a global variable.

  include AuthenticatedSystem
  
  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '810d4e895dfa5ea54645ee489ff950ff'
  
  # See ActionController::Base for details 
  # Uncomment this to filter the contents of submitted sensitive data parameters
  # from your application log (in this case, all fields with names like "password"). 
  # filter_parameter_logging :password
  
  def question_pool_required
    if session[:current_question_pool] == nil
      store_location
      redirect_to :controller => :question_pools, :action => :index
      return false
    else
      return true
    end
  end

end
